//求1+2!+3!+...+20!的和
public class Program21 {
    public static void main(String[] args) {
        //要用长整型long，int型上限不够
        long sum = 0;
        for (int i = 1; i < 21; i++) {
            long multi = 1;
            for (int j = 1; j <= i; j++) {
                multi *= j;
            }
            sum += multi;
        }
        System.out.println(sum);
    }
}